package com.mg.common;

/**
 * 公共返回类
 * @param <T>
 */
public class ResponseJson<T> {
    private int SUCCESS_CODE = 200;
    private int code = SUCCESS_CODE;
    private String msg = "SUCCESS";
    private T data;

    public ResponseJson() {
    }

    public ResponseJson(T data) {
        this.data = data;
    }

    public ResponseJson(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResponseJson(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public boolean isSuccess() {
        return code == SUCCESS_CODE;
    }

    public void setSuccess(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
